API Documentation
Quaternion.h
1 // Quaternion.h
3 //
5 
6 namespace nkMaths
7 {
13  class Quaternion
14  {
15  public :
16 
17  union
18  {
19  float _x ;
20  float _r ;
21  float x ;
22  float r ;
23  } ;
24 
25  union
26  {
27  float _y ;
28  float _g ;
29  float y ;
30  float g ;
31  } ;
32 
33  union
34  {
35  float _z ;
36  float _g ;
37  float z ;
38  float g ;
39  } ;
40 
41  union
42  {
43  float _w ;
44  float _a ;
45  float w ;
46  float a ;
47  } ;
48 
49  public :
50 
64  Quaternion (float x, float y, float z, float w) ;
71  Quaternion (const Vector& axis, float angle) ;
77  Quaternion (const Vector& eulerAngles) ;
83  Quaternion (const Matrix& mat) ;
89  Quaternion (const Quaternion& other) ;
94 
99 
107  Quaternion& setFromAxisAngle (const Vector& axis, float angle) ;
114  Quaternion& setFromEuler (const Vector& angles) ;
129 
130  // Transformations
138  Vector transform (const Vector& vector) const ;
146  Vector& apply (Vector& vector) const ;
147 
148  // Utilities
155  void fromString (const nkMemory::StringView& str) ;
156 
157  // Operators
170  Vector operator* (const Vector& other) const ;
177  Quaternion operator* (const Quaternion& other) const ;
183  void operator*= (const Quaternion& other) ;
190  bool operator== (const Quaternion& other) const ;
191  } ;
192 }
nkMaths::Quaternion::operator*=
void operator*=(const Quaternion &other)
nkMaths::Quaternion::~Quaternion
~Quaternion()
nkMaths
Encompasses all API of component NilkinsMaths.
Definition: IntVector.h:7
nkMaths::Quaternion
A quaternion, symbolizing rotations as a 4D vector.
Definition: Quaternion.h:14
nkMaths::Quaternion::operator=
Quaternion & operator=(const Quaternion &other)
nkMaths::Quaternion::apply
Vector & apply(Vector &vector) const
nkMaths::Quaternion::Quaternion
Quaternion(const Vector &axis, float angle)
nkMaths::Quaternion::setFromEuler
Quaternion & setFromEuler(const Vector &angles)
nkMaths::Matrix
Represents a 4x4 float matrix.
Definition: Matrix.h:14
nkMaths::Quaternion::setFromAxisAngle
Quaternion & setFromAxisAngle(const Vector &axis, float angle)
nkMaths::Quaternion::Quaternion
Quaternion(const Vector &eulerAngles)
nkMaths::Quaternion::Quaternion
Quaternion(const Quaternion &other)
nkMaths::Quaternion::operator==
bool operator==(const Quaternion &other) const
nkMaths::Quaternion::setFromOrientationMatrix
Quaternion & setFromOrientationMatrix(const Matrix &mat)
nkMaths::Quaternion::setFromTransformationMatrix
Quaternion & setFromTransformationMatrix(const Matrix &mat)
nkMaths::Quaternion::transform
Vector transform(const Vector &vector) const
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkMaths::Quaternion::Quaternion
Quaternion(float x, float y, float z, float w)
nkMaths::Quaternion::fromString
void fromString(const nkMemory::StringView &str)
nkMaths::Quaternion::Quaternion
Quaternion(const Matrix &mat)
nkMaths::Quaternion::getAsEulerAngles
Vector getAsEulerAngles() const
nkMaths::Quaternion::operator*
Vector operator*(const Vector &other) const
nkMaths::Vector
A 4-component vector class, with floats.
Definition: Vector.h:12
nkMaths::Quaternion::Quaternion
Quaternion()